# -*- codeing = utf-8 -*-
from lxml import etree
import requests
URL = 'https://cd.ke.com/ershoufang/rs/'
headers = {
    'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.25 Safari/537.36 Core/1.70.3877.400 QQBrowser/10.8.4506.400'
}
resp = requests.get(url=URL,headers=headers)
print(resp.status_code)
root = etree.HTML(resp.text)
li_list = root.xpath('/html/body/div[1]/div[@class="content "]/div[@class="leftContent"]/div[4]/ul//li[@class="clear"]')
#print(len(li_list))
for i in li_list:
    house_title = i.xpath('div[1]/div/a/text()')[0]
    herf = i.xpath('div[1]/div/a/@href')[0]
    print(house_title,herf)